{include file="public/header" /}
<body class="hide-top">
<div class="pro-list-search">
    <i class="layui-icon layui-icon-left" onclick="goBack()"></i>
    <div class="rgt">
        <img src="/static/index/img/icon43.png" alt="">
        <input type="text" class="keyword" placeholder="输入关键字热门">
        <p class="flex-center search_bt">搜索</p>
    </div>
</div>
<div class="flex-layout search-history">历史搜索
    {if count($history) > 0}
    <img src="/static/index/img/icon14.png" alt=""  class="del">
    {/if}
</div>
<ul class="search-list">
    {foreach name="history" item="vo"}
    <li class="only" onclick="load_href('{:url(\'product/index\')}?keyword={$vo}',2)">{$vo}</li>
    {/foreach}
</ul>
</body>
{include file="public/footer" /}
<script>
    $(function () {
        $(".search_bt").click(function () {
            var keyword = $(".keyword").val();
            if (!keyword) {
                layer.msg('请输入要搜索的内容');
                return false;
            }
            location.href = '{:url("product/index")}?keyword=' + keyword;
        });
        $(".del").click(function (){
            layer.confirm('是否清空搜索历史记录？', {title: '请确认'}, function () {
                _ajax('{:url("product/clearSearch")}');
            });
        });
    });
</script>
</html>